package com.raycloud.robot.custom.zdfUtils.dto.req;

import com.google.common.collect.ImmutableMap;
import java.util.UUID;
import java.util.Objects;
import com.google.common.collect.Maps;
import java.util.Map;
import com.raycloud.robot.custom.zdfUtils.dto.ZdfEntity;
import java.util.List;
import com.raycloud.robot.custom.zdfUtils.dto.resp.UploadPictureUrlZdfResponse;
import com.raycloud.robot.custom.zdfUtils.dto.basic.BaseZdfRequest;

public class UploadPictureUrlZdfRequest implements BaseZdfRequest<UploadPictureUrlZdfResponse>{
    private List<String> groups;
    private Boolean disableDetect;
    private ZdfEntity zdfEntity;
    public UploadPictureUrlZdfRequest(){
        this.disableDetect=Boolean.FALSE;
    }
    public List<String> getGroups(){
        return this.groups;
    }
    public void setGroups(final List<String> groups){
        this.groups=groups;
    }
    public Boolean getDisableDetect(){
        return this.disableDetect;
    }
    public void setDisableDetect(final Boolean disableDetect){
        this.disableDetect=disableDetect;
    }
    public ZdfEntity getZdfEntity(){
        return this.zdfEntity;
    }
    public void setZdfEntity(final ZdfEntity zdfEntity){
        this.zdfEntity=zdfEntity;
    }
    @Override
    public String getHttpPath(){
        return "/entities/v2/add";
    }
    @Override
    public Map<String,Object> getParams(){
        final Map<String,Object> conditon=(Map<String,Object>)Maps.newHashMap();
        if(Objects.nonNull(this.zdfEntity)){
            conditon.put("entity",ImmutableMap.of("entity_id",UUID.randomUUID().toString(),"image_url",this.zdfEntity.getImageUrl(),"additional",this.zdfEntity.getAdditional().toJSONString()));
            conditon.put("groups",this.groups);
            conditon.put("disable_detect",this.disableDetect);
            return conditon;
        }
        throw new IllegalArgumentException("zdf picture entity is null");
    }
    @Override
    public Class<UploadPictureUrlZdfResponse> getResponseClass(){
        return UploadPictureUrlZdfResponse.class;
    }
}
